package com.cubeofnine.sugar.service.element;

import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;

public class UserAuth implements KvmSerializable {

	private String user_name;
	private String password;
	private String version;

	public UserAuth() {

	}

	public UserAuth(SoapObject obj) {
		this.user_name = obj.getProperty("user_name").toString();
		this.password = obj.getProperty("password").toString();
		this.version = obj.getProperty("version").toString();
	}

	public Object getProperty(int index) {
		Object object = null;

		switch (index) {
		case 0:
			object = this.user_name;
			break;
		case 1:
			object = this.password;
			break;
		case 2:
			object = this.version;
			break;
		}

		return object;
	}

	public int getPropertyCount() {
		return 3;// Count GloVariable
	}

	public void getPropertyInfo(int index, Hashtable arg1,
			PropertyInfo propertyInfo) {
		switch (index) {
		case 0:
			propertyInfo.name = "user_name";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		case 1:
			propertyInfo.name = "password";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		case 2:
			propertyInfo.name = "version";
			propertyInfo.type = PropertyInfo.STRING_CLASS;
			break;
		}
	}

	public void setProperty(int index, Object obj) {
		switch (index) {
		case 0:
			this.user_name = obj.toString();
			break;
		case 1:
			this.password = obj.toString();
			break;
		case 2:
			this.version = obj.toString();
			break;
		}
	}

	public String getUser_name() {
		return user_name;
	}

	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

}
